<?php
$start = new Start();
$cu = $start->userinfo('','uid,name,sex',$sid);
$sql = "SELECT * FROM ".DB_PRE."user WHERE uid = ".$cu['uid'];
$cku = $db->get_one($sql);
if(!$cku){
	//$start->newuser($cu['uid'],$cu['name']);
}
$friendsid = $api->friends_get($cu['uid']);
//获取提交数据
if ($submit){
	$data['juese'] = $_POST['juese'];
	$data['content'] = $_POST['content'];
	$totmp = explode("___", $_POST['tou']);
	$data['touid'] = $totmp[0];
	$data['touname'] = $totmp[1];
	
	if($data['touid']=='null') message('请选择好友！');
	if($data['juese']=='null') message('请选择角色！');
	if($data['content']=='null') message('一个字也不说？');
	$start->newduihua($data);
	$content = '你的朋友'.$cu['name'].'在【角色公园】扮演了一个角色，想知道吗？ 你想扮演什么呢？快来看看吧...';
	$urltitle = '马上进入';
	$url = SITE_URL.'index.php';
	//测试给自己发在线消息
	$api->message_sendonline(3031283052,$content,$urltitle,$url);
	foreach ($friendsid['uid'] as $f) {
		$api->message_sendonline($f,$content,$urltitle,$url);
	}
	message('提交成功！');
}



$jueselist = $db->select("SELECT id,title FROM ".DB_PRE."juese ORDER BY count DESC");
$friends = $api->friends_getfriends($cu['uid']);

$newduihua = $db->select("SELECT * FROM ".DB_PRE."duihua ORDER BY id DESC LIMIT 20");


include tpl($mod.'.'.$act);
?>